package com.wry.cloud.api.impl;

import com.wry.cloud.api.OrderApiService;
import com.wry.cloud.dao.OrderMapper;
import com.wry.cloud.entity.Order;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * <h1> 订单业务-功能实现层 <h1>
 *
 * @author 魏如元
 * @since 2022/10/6
 */
@Service
@Slf4j
public class OrderApiServiceImpl implements OrderApiService {

    @Resource
    private OrderMapper orderMapper;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void createOrder(Order order) {
        orderMapper.insert(order);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void updateByUserId(Long userId, Integer status) {
        orderMapper.updateByUserId(userId, status);
    }
}
